<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">
    <title><?php echo $OJ_NAME?></title>
      <?php include("template/bs3/css.php");?>
      <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
      <!--[if lt IE 9]>
      <script src="http://cdn.bootcss.com/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
      <![endif]-->
      <script src="common-static/jquery.min.js"></script>
      <script src="template/bs3/bootstrap.min.js"></script>
  </head>
  <script>
      $(document).ready(function () {
          // 添加辅助解释
          var pats=new Array();
          var exps=new Array();

          pats[0]=/A Not allowed system call.* /;
          exps[0]="使用了系统禁止的操作系统调用，看看是否越权访问了文件或进程等资源,如果你是系统管理员，而且确认提交的答案没有问题，测试数据没有问题，可以发送'RE'到微信公众号onlinejudge，查看解决方案。";
          pats[1]=/Segmentation fault/;
          exps[1]="段错误，检查是否有数组越界，指针异常，访问到不应该访问的内存区域";
          pats[2]=/Floating point exception/;
          exps[2]="浮点错误，检查是否有除以零的情况";
          pats[3]=/buffer overflow detected/;
          exps[3]="缓冲区溢出，检查是否有字符串长度超出数组的情况";
          pats[4]=/Killed/;
          exps[4]="进程因为内存或时间原因被杀死，检查是否有死循环";
          pats[5]=/Alarm clock/;
          exps[5]="进程因为时间原因被杀死，检查是否有死循环，本错误等价于超时TLE";
/*
          function explain(){
              var errmsg=document.getElementById("errtxt").innerHTML;
              var expmsg="辅助解释：<br>";
              for(var i=0;i<pats.length;i++){
                  var pat=pats[i];
                  var exp=exps[i];
                  var ret=pat.exec(errmsg);
                  if(ret){
                      expmsg+=ret+":"+exp+"<br>";
                  }

              }
              //expmsg += "1. 超时问题：C程序中，一秒内累计可循环300,000,000(8个0)次。<br/>"
              //expmsg += "2. 浮点数问题：因为在计算机中浮点运算是存在误差的，如果遇到浮点数结果与标准结果有差异，优先选用double<br/>"
              document.getElementById("errexp").innerHTML=expmsg;
          }
          explain();*/
          $('#judge_detail').hide()
          $("#detail_btn").on('click touch',function(){
              if ( $("#judge_detail").is(":visible") ) {
                  $('#judge_detail').hide()
                  $("#detail_btn").html("更多详情...")
                  $("body,html").animate({
                      scrollTop: 0
                  }, 300)
              }else {
                  $('#judge_detail').show()
                  $("#detail_btn").html("收起...")
                  $("body,html").animate({
                      scrollTop: $(this).offset().top - 50
                  }, 300)
              }
          })
      })
</script>
  <body>
  <div class="container">
      <?php include("template/bs3/nav.php");?>
      <div class="col-lg-12 col-xs-12">
          <!--评测记录详情-->
          <div class="col-lg-8 col-xs-12">
              <table class="table table-bordered">
                  <caption>
                      <span style="color:orange; font-size:1.4rem;font-weight: bold;">评测得分：<?php echo $total_score?></span>
                      <span style="color: blue; font-size: 1.2rem;">
                      (<?php echo $passTestCnt?>/<?php echo $totalTestCnt?>)
                  </span>
                      <span style="color:gray;margin-left: 0.7rem;">
                      每天最多可下载样例文件<?php echo $max_down_cnt?>次, 当前剩余<?php echo $left_down_cnt?>次
                  </span>
                      <span style="margin-left: 1rem;">
                      <?php echo "<a href='problem.php?id=".$problem_id."'>题目:".$problem_id."</a>";?>
                  </span>
                  </caption>
                  <thead>
                  <tr class='toprow' >
                      <th>样例名称
                      <th>样例输入
                      <th>正确输出
                      <th>评测结果
                  </tr>
                  </thead>
                  <tbody>
                  <?php
                  $cnt=0;
                  foreach($judgeDetailList as $detail){
                      echo "<tr>";
                      echo "<td>".$detail['filename']."</td>";
                      if ( strlen($detail['inputfile']) > 0 ) {
                          echo "<td><a href='".$detail['inputfile']."'>下载输入文件</a></td>";
                      }else {
                          echo '<td>--</td>';
                      }

                      if (strlen($detail['outputfile']) > 0 ) {
                          echo "<td><a href='".$detail['outputfile']."'>下载输出文件</a></td>";
                      }else {
                          echo '<td>--</td>';
                      }
                      echo "<td>".$detail['result']."</td>";
                      echo "</tr>";
                  }
                  ?>
                  </tbody>
              </table>
          </div>
          <div class="col-lg-8 col-xs-12">
              <button style = "height: 2.2rem;color:blue; font-size: 1.1rem;" id="detail_btn" class="col-lg-offset-9 col-lg-2 col-xs-12">
                  更多详情...
              </button>
          </div>
          <div class="col-lg-8 col-xs-12" id="judge_detail">
              <pre id='errtxt' class="alert"><?php echo $view_reinfo?></pre><br/>
          </div>
      </div>
  </div> <!-- /container -->
  </body>
</html>
